<template>
  <el-dialog
    title="请选择流程"
    :visible="showChooseFlow"
    width="50%"
    append-to-body
    @close="handleClose"
  >
    <el-table v-loading="loading" :data="maintainList" @row-click="rowClick">
      <el-table-column label="流程名称" align="center" prop="processName" />
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </el-dialog>
</template>

<script>
import { listProcess } from "@/api/flow/workflow";
export default {
  name: "index",
  props: {
    flowTitle: {
      type: String
    },
    showChooseFlow: {
      type: Boolean
    }
  },
  data() {
    return {
      total: 0,
      loading: true,
      maintainList: [],
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.loading = true;
      this.loading = true;
      listProcess(this.queryParams).then(response => {
        this.maintainList = response.rows;
        this.total = response.total;
        this.loading = false
      })
    },
    rowClick(item) {
      this.$emit('ok', item)
    },
    handleClose() {
      this.$emit("close")
    }
  }
}
</script>

<style scoped>

</style>
